<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});

//基本路由
Route::get("/hello",function(){
    return "hello world!";
});

//基本路由
Route::get("/hello1",function(){
    return url("aa");  //生成地址
});


//带参数的路由
Route::get("/hello/{id}",function($id){
    return "参数路由ID".$id;
});

//可选参数路由
Route::get("/demo/{id?}",function($id=0){
    return "可选参数路由ID".$id;
});

//通过URL 访问控制和方法
Route::get("/photo","photoController@index");
Route::get("/photo/test","photoController@test");
Route::get("/photo/getlist","photoController@getList");

Route::get("/new/delete/{id}","NewController@delete");
Route::post("/new/update","NewController@update");
//资源路由
Route::resource('new', 'NewController');